1. Field of the Invention
The present invention relates, in general, to data caching and, more particularly, to a data caching pattern enabling caching in a distributed JAVA programming environment.
2. Relevant Background
The JAVA(trademark) programming environment is a popular environment for implementing software systems. JAVA is a trademark of Sun Microsystems, Inc. in the United States and other countries. Because the JAVA programming environment is largely platform independent, programs are readily ported to a number of hardware and software platforms. This portability is particularly useful in distributed computing environments comprising a heterogeneous collection of clients, servers, and interconnection devices. For example, software applications based on world wide web infrastructure, also called xe2x80x9cweb-based applicationsxe2x80x9d often rely on code, applets, servelets, beans, and the like to provide cross-platform functionality.
Computer software systems typically comprise a hierarchy of mechanisms with the user-level programs operating at or near the top of the hierarchy. In object oriented software environments a program is designed as a collection of interacting structures called xe2x80x9cobjects.xe2x80x9d Objects are characterized by the methods and attributes contained by the object and the interface used to access the object""s methods and attributes. The attributes may be primitives such as an integer or string value, or may be a reference to another object. Objects having similar characteristics and common behaviors are grouped together into a xe2x80x9cclassxe2x80x9d.
Design patterns are one of the most effective and efficient techniques of object oriented design. A xe2x80x9cpatternxe2x80x9d can be defined as an abstraction from a concrete form which keeps recurring in specific non-arbitrary contexts. In other words, a software pattern is a structure or mechanism that embodies the essential features of a solution to a recurring problem. Hence, the pattern can be used to generate specific solutions to specific problems once the context of the specific problem is known. In this manner, a pattern provides a highly reuseable structure and makes efficient use of the software developer""s efforts.
One recurring problem in web-based environments is speed performance. To implement web-based applications, data and objects are exchanged over a network connection. This exchange involves multiple types of data including calendar data, mail, messages, graphics, applets, and the like. The latency associated with this exchange is both large and variable. Caching is a widely used technique to improve data processing performance where access latency is a performance limiting factor. Caching technology is applied to almost every level of a computer implemented system including hardware and software managed caches.
Web-based applications typically benefit from object caches that store software objects referenced by the application in a local storage device such as memory or magnetic or optical disks. An initial reference to an object causes the object to be returned over the network from its source (e.g., a database, web server, or other resource). The returned object is then stored in a cache having a lower latency than the network. Subsequent references to the object can be obtained from the cache thereby avoiding the latency associated with the network connection.
One difficulty in implementing object caches for web-based applications is the great variety of object types that must be cached. An object holding a simple text record or hash table has quite different properties from another record holding a complex animated graphic. Moreover, the ever expanding use of web-based applications means that new object types, with corresponding new cache demands, are continually arising.
Until now, the some programming environments, such as the JAVA programming environment, have lacked a caching pattern for readily implementing caches for these heterogeneous objects. As a result, many application developers have chosen to not implement object caches. Where a n object cache was required, the application developer would create a unique caching solution to meet the needs of a specific application. Because these solutions were application-specific, they tend to not be reusable o r extensible t o new applications. What is needed is a reusable, flexible caching solution for web-based applications. More specifically, a need exits for a caching pattern for the JAVA programming environment.
A feature of some programming environments, including the JAVA programming environment, is that objects are passed by reference and not by value. In a cache solution this means that a cached object is not actually returned to the application when it is reused. Instead, only a reference to t he cached object is returned. Any changes made to the cached object by the calling are mad e on the cached object itself. This creates a coherency problem in that other processes that reference the cached object will see the changed object, no t the original. Hence, a need exists for a caching method and system that enables multiple processes to use cached objects coherently.
Briefly stated, the present invention provides a caching pattern including an extensible cache entry component that includes methods for retrieving, updating, and setting expiration parameters for a cache entry. A cache store component includes methods for reading and writing objects to cache entries. A cache manager component includes methods implementing a first interface to the cache store component to cause the cache store component to read and write objects to the data store and includes methods implementing a second interface to the cache entry component for adding, removing, getting and committing data to the cache entry.